<?php

namespace App\Admin\Controller\Base;

use App\AbstractController;
use App\Admin\AbstractAdminController;
use App\Admin\Middleware\AuthenticateMiddleware;
use App\Admin\Middleware\PermissionsMiddleware;
use App\Admin\Service\Base\RouteService;
use App\Common\Util\Response;
use App\Common\Util\TP;
use think\annotation\route\Group;
use think\annotation\route\Middleware;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;

/**
 * Class IndexController
 */
class IndexController extends AbstractAdminController
{
    /**
     * 首页
     */
    public function index(): string
    {
        return Response::render('Base/index');
    }

    /**
     * 首页
     * @return string
     */
    public function home(): string
    {
        return Response::render('Base/index/home');
    }

    /**
     * 获取菜单
     *
     * @return \think\Response
     * @throws DataNotFoundException
     * @throws DbException
     * @throws ModelNotFoundException
     */
    public function getMenu(): \think\Response
    {
        $menu = RouteService::aop()->getMenu();

        return Response::json()->success($menu);
    }
}